package stopthread;

/**
 * @description:
 * @author: jhy
 * @time: 2021/4/11 22:48
 */

//使用stop方法暴力停止线程
public class StopThreadDemo1 {
    public static void main(String[] args) throws InterruptedException {
        MyThread2 myThread = new MyThread2();
        myThread.start();
        Thread.sleep(20);
        myThread.stop();
    }

}
class MyThread2 extends Thread{
    @Override
    public void run() {
        for(int i = 0;i < 50000;i++){
            System.out.println("i=" + (i+1));
        }
    }
}
